/*
 * AboutPanel.java
 *
 * Created on March 13, 2007, 5:41 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package net.sf.iSnake.UI;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Insets;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import net.sf.iSnake.configuration.iSnakeConfiguration;

/**
 *
 * @author thelinuxmaniac
 */

public class AboutPanel extends JPanel {
    
    private static iSnakeConfiguration conf;
    private JPanel configOptionPanel;
    
    private JButton playNowButton;
    private JButton goBackButton;
    
    private Font fontLabel;
    private Font fontHeader;
    
    private static String panelName = "AboutPanel";                    // Required by CardManagerLayout to refer to this panel
    
    /** Creates a new instance of AboutPanel */
    public AboutPanel(iSnakeConfiguration conf) {
        this.conf = conf;
        setLayout(new BorderLayout());
        setBackground(conf.StandaloneModeBackgroundColor);
        fontLabel = new Font(conf.StandaloneModeFont,Font.PLAIN,conf.StandaloneModeFontSize);
        fontHeader = new Font(conf.StandaloneModeHeaderFont,Font.BOLD,conf.StandaloneModeHeaderFontSize);
        
        configOptionPanel = new JPanel(new GridLayout(6,1));
        setPreferredSize(new Dimension(300,200));
        configOptionPanel.setFont(fontLabel);
        configOptionPanel.setBackground(conf.StandaloneModeBackgroundColor);
        
        JLabel developedByLabel = conf.getLabelForUIPanel(new JLabel("Developed by:"));
        configOptionPanel.add(developedByLabel);
        
        JLabel programmerName1 = conf.getLabelForUIPanel(new JLabel("Abhishek Dutta, thelinuxmaniac@gmail.com"));
        configOptionPanel.add(programmerName1);
        
        JLabel programmerName2 = conf.getLabelForUIPanel(new JLabel("Jitendra Harlalka, implements.java@gmail.com"));
        configOptionPanel.add(programmerName2);
        
        JLabel programmerName3 = conf.getLabelForUIPanel(new JLabel("Suraj Sapkota, suraj_sapkota@gmail.com"));
        configOptionPanel.add(programmerName3);
        
        JLabel dummyPanel = conf.getLabelForUIPanel(new JLabel(" "));
        configOptionPanel.add(dummyPanel);
        
        goBackButton = conf.getPanelChangeButtonForUIPanel(new JButton("go back to main menu"));
        goBackButton.setMnemonic('A');
        goBackButton.setActionCommand("from_AboutPanel_to_MainMenu");
        configOptionPanel.add(goBackButton);
        
        // used for proper placement of components
        JLabel dummyNorth = new JLabel("");
        dummyNorth.setPreferredSize(new Dimension(800,140));        // height of logo=120px and 20px for padding purpose
        
        // used for proper placement of components
        JLabel dummySouth = new JLabel("");
        dummySouth.setPreferredSize(new Dimension(800,260));        // height of logo=120px and 20px for padding purpose

        // used for proper placement of components
        JLabel dummyWest = new JLabel("");
        dummyWest.setPreferredSize(new Dimension(200,400));        // height of logo=120px and 20px for padding purpose
        
        // used for proper placement of components
        JLabel dummyEast = new JLabel("");
        dummyEast.setPreferredSize(new Dimension(200,400));        // height of logo=120px and 20px for padding purpose
        
        add(configOptionPanel,BorderLayout.CENTER);
        add(dummyNorth,BorderLayout.NORTH);
        add(dummySouth,BorderLayout.SOUTH);
        add(dummyWest,BorderLayout.WEST);
        add(dummyEast,BorderLayout.EAST);
    }
    
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        g.drawImage(conf.getISnakeLogoSmall(),10,10,null);
        
        g.setFont(fontHeader);
        g.setColor(conf.StandaloneModeHeaderColor);
        g.drawString("About",280,100);

    }

    public static String getPanelName() {
        return panelName;
    }

    public static void setPanelName(String aPanelName) {
        panelName = aPanelName;
    }

    public JButton getGoBackButton() {
        return goBackButton;
    }
}
